package com.palm.hubo2o.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.Expose;
import com.palm.hubo2o.util.EnumCode;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dest1 on 2015/10/26.
 */
public class Bet implements Parcelable {
    public static final String TAG = Bet.class.getName();
    @Expose
    private EnumCode.gameId gameId;//彩种
    @Expose
    private String wager;//选号内容
    @Expose
    private int wagerCount;//选号注数
    @Expose
    private long issueNo;//期号
    @Expose
    private int multiple;//倍数
    @Expose
    private int seriesNo;//追号期数，直投传1
    @Expose
    private int totalMoney;//总金额
    @Expose
    private int hitStop;//停追类型，直投可不传 值为0：不停追，1：中奖停追，2：中大奖停追

    private EnumCode.PlayType playType;//玩法
    private List<String> reds;//红球号码
    private List<String> tuos;//拖码
    private List<String> blues;//蓝球号码
    private String sign = ",";

    public Bet(EnumCode.gameId gameId) {
        this.gameId = gameId;
        reds = new ArrayList<>();
        tuos = new ArrayList<>();
        blues = new ArrayList<>();
    }

    public EnumCode.gameId getGameId() {
        return gameId;
    }

    public void setGameId(EnumCode.gameId gameId) {
        this.gameId = gameId;
    }

    public String getWager() {
        return wager;
    }

    public void setWager(String wager) {
        this.wager = wager;
    }

    public int getWagerCount() {
        return wagerCount;
    }

    public void setWagerCount(int wagerCount) {
        this.wagerCount = wagerCount;
    }

    public long getIssueNo() {
        return issueNo;
    }

    public void setIssueNo(long issueNo) {
        this.issueNo = issueNo;
    }

    public int getMultiple() {
        return multiple;
    }

    public void setMultiple(int multiple) {
        this.multiple = multiple;
    }

    public int getSeriesNo() {
        return seriesNo;
    }

    public void setSeriesNo(int seriesNo) {
        this.seriesNo = seriesNo;
    }

    public int getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(int totalMoney) {
        this.totalMoney = totalMoney;
    }

    public int getHitStop() {
        return hitStop;
    }

    public void setHitStop(int hitStop) {
        this.hitStop = hitStop;
    }

    public EnumCode.PlayType getPlayType() {
        return playType;
    }

    public void setPlayType(EnumCode.PlayType playType) {
        this.playType = playType;
    }

    public List<String> getReds() {
        return reds;
    }

    public void setReds(List<String> reds) {
        this.reds = reds;
    }

    public List<String> getBlues() {
        return blues;
    }

    public void setBlues(List<String> blues) {
        this.blues = blues;
    }

    public List<String> getTuos() {
        return tuos;
    }

    public void setTuos(List<String> tuos) {
        this.tuos = tuos;
    }


    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.gameId == null ? -1 : this.gameId.ordinal());
        dest.writeString(this.wager);
        dest.writeInt(this.wagerCount);
        dest.writeLong(this.issueNo);
        dest.writeInt(this.multiple);
        dest.writeInt(this.seriesNo);
        dest.writeInt(this.totalMoney);
        dest.writeInt(this.hitStop);
        dest.writeInt(this.playType == null ? -1 : this.playType.ordinal());
        dest.writeStringList(this.reds);
        dest.writeStringList(this.tuos);
        dest.writeStringList(this.blues);
        dest.writeString(this.sign);
    }

    public Bet() {
    }

    protected Bet(Parcel in) {
        int tmpGameId = in.readInt();
        this.gameId = tmpGameId == -1 ? null : EnumCode.gameId.values()[tmpGameId];
        this.wager = in.readString();
        this.wagerCount = in.readInt();
        this.issueNo = in.readLong();
        this.multiple = in.readInt();
        this.seriesNo = in.readInt();
        this.totalMoney = in.readInt();
        this.hitStop = in.readInt();
        int tmpPlayType = in.readInt();
        this.playType = tmpPlayType == -1 ? null : EnumCode.PlayType.values()[tmpPlayType];
        this.reds = in.createStringArrayList();
        this.tuos = in.createStringArrayList();
        this.blues = in.createStringArrayList();
        this.sign = in.readString();
    }

    public static final Creator<Bet> CREATOR = new Creator<Bet>() {
        @Override
        public Bet createFromParcel(Parcel source) {
            return new Bet(source);
        }

        @Override
        public Bet[] newArray(int size) {
            return new Bet[size];
        }
    };
}